package com.cyy.info.controller;

import com.cyy.info.pojo.Info;
import com.cyy.info.service.InfoService;
import com.cyy.info.service.impl.InfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/info")
public class InfoController {

    @Autowired
    private InfoService infoService;

    @RequestMapping("/findAll")
    public ModelAndView findAll(){
        ModelAndView modelAndView = new ModelAndView();
        List<Info> list = infoService.findAll();
        modelAndView.addObject("infoList",list);
        modelAndView.setViewName("info");
        return modelAndView;
    }
}
